<include file="public@header" />
</head>
<body>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="photo_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="photo_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>

	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:url('user/index')}">员工管理</a></li>
			<li class="active"><a href="{:url('user/add')}">员工添加</a></li>
		</ul>
	<form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('user/addpost')}">

		 <div class="row">
		 <div class="col-md-9">
		  <table class="table table-bordered">
			        <tr>
                        <th style="width: 170px"><span class="form-required">*</span>{:lang('USERNAME')}</th>
                        <td>
                           <input type="text" class="form-control" id="input-user_login" name="post[user_login]" required="required">
                        </td>
                    </tr>
                      <tr>
                        <th style="width: 170px">身份证</th>
                        <td>
                           <input type="text" class="form-control"  name="post[sfz]">
                        </td>
                    </tr>
                     <tr>
                        <th style="width: 170px">手机号码</th>
                        <td>
                           <input type="text" class="form-control"  name="post[mobile]">
                        </td>
                    </tr>
                    <tr>
                        <th style="width: 170px">紧急联系人</th>
                        <td>
                           <input type="text" class="form-control"  name="post[jjlianxi]">
                        </td>
                    </tr>
                    <tr>
                        <th style="width: 170px">联系地址</th>
                        <td>
                           <input type="text" class="form-control"  name="post[address]">
                        </td>
                    </tr>
                     <tr>
                        <th style="width: 170px">{:lang('PASSWORD')}</th>
                        <td>
                          <input type="password" class="form-control" id="input-user_pass" name="post[user_pass]" placeholder="******">
                        </td>
                    </tr>
                     <tr>
                        <th style="width: 170px">重复密码</th>
                        <td>
                         <input type="password" class="form-control" id="input-user_pass" name="post[d_pass]">
                        </td>
                    </tr>
                     <tr>
                        <th style="width: 170px">{:lang('EMAIL')}</th>
                        <td>
                        <input type="text" class="form-control" id="input-user_email" name="post[user_email]">
                        </td>
                    </tr>
			 		<tr>
                        <th style="width: 170px">QQ</th>
                        <td>
                        <input type="text" class="form-control" id="input-user_qq" name="post[qq]">
                        </td>
                    </tr>
                     <tr>
                        <th style="width: 170px">性别</th>
                        <td>
                    男<input type="radio" value="2" name="sex">
					女<input type="radio" value="1" name="sex">
                        </td>
                    </tr>
                      <tr>
                        <th style="width: 170px">附件照片上传</th>
                        <td>
                    <ul id="photos" class="pic-list list-unstyled form-inline"></ul>
                     <a href="javascript:uploadMultiImage('图片上传','#photos','photos-item-tpl');"
                               class="btn btn-default btn-sm">选择图片</a>
                        </td>
                    </tr>
                     <tr>
                        <th>工作经历</th>
                        <td>
                            <script type="text/plain" id="content" name="post[bak]"></script>
                        </td>
                    </tr>
			         <tr>
                        <th>角色</th>
                        <td>
                            <input type="text"  style="cursor: pointer;"  name="role_name"  id="role_select"  class="form-control"  value="点击选择角色"  readonly>
                            <input type="hidden" name="post[role_id]" id="role_id"  value="">
                            <input type="hidden" name="post[company_id]" value="{$company['id']|default=0}">
                        </td>
                      </tr>
             </table>
        <!--角色弹窗-->
        <div id="roleselect_tc" style="display: none;">
          <div id="roleselect_list" style="margin: 5px;"></div>
        </div>

			 <div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				</div>
			</div>
			
			</div>
				
 <div class="col-md-3">
                <table class="table table-bordered">
                    <tr>
                        <th><b>头像上传</b></th>
                    </tr>
                    <tr>
                        <td>
                            <div style="text-align: center;">
                                <input type="hidden" name="post[avatar]" id="thumbnail" value="">
                                <a href="javascript:uploadOneImage('图片上传','#thumbnail');">
                                    <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                         id="thumbnail-preview"
                                         width="130" height="130"  style="cursor: pointer;border-radius: 50%"/>
                                </a>
                                <input type="button" class="btn btn-sm btn-cancel-thumbnail" value="取消图片">
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th><b>籍贯</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control" type="text" name="post[jiguan]"
                                   value="">
                        </td>
                    </tr>
                     <tr>
                        <th><b>毕业学院</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control" type="text" name="post[byxy]"
                                   value="">
                        </td>
                    </tr>
                    <tr>
                        <th><b>学历</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control" type="text" name="post[xueli]"
                                   value="">
                        </td>
                    </tr>
                    <tr>
                        <th><b>专业</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input type="text" class="form-control" name="post[zhuanye]"
                                   value="">
                        </td>
                    </tr>            
                    <tr>
                        <th><b>实习时间</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control js-bootstrap-date" type="text" name="post[sx_time]"
                                   value="{:date('Y-m-d H:i:s',time())}">
                        </td>
                    </tr>
                  
                     <tr>
                        <th><b>入职时间</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control js-bootstrap-date" type="text" name="post[rz_time]"
                                   value="{:date('Y-m-d H:i:s',time())}">
                        </td>
                    </tr>
                    <tr>
                    <th><b>生日</b></th>
                    </tr>
                    <tr>
                        <td>
                            <input class="form-control js-bootstrap-date" type="text" name="post[birthday]"
                                   value="">
                        </td>
                    </tr>
                </table>
            </div>

		
	</div>
	
	</form>
	</div>
	<script type="text/javascript">
    $(function () {

        editorcontent = new baidu.editor.ui.Editor();
        editorcontent.render('content');
        try {
            editorcontent.sync();
        } catch (err) {
        }

        $('.btn-cancel-thumbnail').click(function () {
            $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
            $('#thumbnail').val('');
        });

    });
		</script>
	<script src="__STATIC__/js/admin.js"></script>
	<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>
<script src="__STATIC__/js/zy-treeview/zy-treeview.1.0.js"></script>


<script  type="text/javascript">

$(function(){
  var SELECT_ID=null,SELECT_NAME=null;
  var list={$roleList};
  var highest=null;
    //选择角色弹窗·
  //获取角色id
  var role_id=$('input[id=role_id]').val();
  $('#role_select').on('click',function(){ 
  $("#roleselect_list").treeView({data:list,radio:true});
      //加载角色数据
      //弹出选择框
      var index=layer.open({
                    type: 1,
                    title: '修改角色',
                    area: ['700px', '600px'],
                    closeBtn: 1,
                    btn:['确定','取消'],
                    shadeClose: true,
                    skin: 'yourclass',
                    scrollbar: false,
                    content: $("#roleselect_tc "),
                    yes:function(){
                      //获取选中数据
                      $('input[id=role_id]').val(SELECT_ID);
                      $('input[name=role_name]').val(SELECT_NAME);
                      layer.close(index);
                    }
      });
  });

//列表点击事件
    $("#roleselect_list").on('click','li',function(){
        $(this).css('backgroundColor','#ccc');
        var  name=$(this).find('.li_text').text();
        console.log('调皮');
        var id=$(this).data('tag');
        console.log(id);
        $(this).find('.tree_radio').prop('checked',true);
        SELECT_ID=id;
        SELECT_NAME=name;
/*        $('input[id=role_id]').val(id);
        $('input[name=role_name]').val(name);*/
      });
});
</script>



</body>
</html>